package com.letao.interceptor;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.apache.struts2.ServletActionContext;

import com.letao.service.UserServiceInterface;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.AbstractInterceptor;

public class AuthorityInterceptor extends AbstractInterceptor {
	private UserServiceInterface userServiceInterface;
	@Override
	public String intercept(ActionInvocation invocation) throws Exception {
		// TODO Auto-generated method stub
		Map session=ActionContext.getContext().getSession();
		if(session.get("user")==null){
			return "login";//如果未登陆，则转入name=login的全局result,最终转入login.action
		}else{
			return invocation.invoke();
		}
	}
	public UserServiceInterface getUserServiceInterface() {
		return userServiceInterface;
	}
	public void setUserServiceInterface(UserServiceInterface userServiceInterface) {
		this.userServiceInterface = userServiceInterface;
	}
	
}
